package com.gwnet.shop.controller.api;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.gwnet.common.log.annotation.Log;
import com.gwnet.common.log.enums.BusinessType;
import com.gwnet.common.mybatis.core.page.TableDataInfo;
import com.gwnet.shop.controller.MBaseController;
import com.gwnet.shop.domain.ShopType;
import com.gwnet.shop.service.IShopTypeService;
import com.gwnet.shop.utils.AjaxResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 商城类型Controller
 * 
 * @author 张万鹏
 * @date 2024-07-30
 */
@RestController
@RequestMapping("/api/shoptype")
public class ShopTypeApiController extends MBaseController
{
    @Resource
    private IShopTypeService shopTypeService;

    /**
     * 查询商城类型列表
     */
    @SaCheckPermission("shop:shoptype:list")
    @GetMapping("/list")
    public TableDataInfo list(ShopType shopType)
    {
        startPage();
        List<ShopType> list = shopTypeService.selectShopTypeList(shopType);
        return getDataTable(list);
    }


    /**
     * 获取商城类型详细信息
     */
    @SaCheckPermission("shop:shoptype:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(shopTypeService.selectShopTypeById(id));
    }

}
